Skip to contentMethod: ReferencerException(Token, String)
1: package de.fhdw.wtf.common.exception.referencer;
2:
3: import de.fhdw.wtf.common.exception.walker.TaskException;
4: import de.fhdw.wtf.common.token.Position;
5: import de.fhdw.wtf.common.token.Token;
6:
7: /**
8: * It is a general abstract Exception for Referencer-Exceptions.
9: *
10: */
11: public abstract class ReferencerException extends TaskException {
12:
13: /**
14: * generated.
15: */
16: private static final long serialVersionUID = 6930888853075370916L;
17:
18: /**
19: * Start-Position.
20: */
21: private final Position posStart;
22:
23: /**
24: * End-Position.
25: */
26: private final Position posEnd;
27:
28: /**
29: * Constructor of {@link ReferencerException}.
30: *
31: * @param token
32: * token
33: * @param message
34: * message
35: */
36: public ReferencerException(final Token token, final String message) {
37: super(message);
38: this.posStart = token.getPosition();
39: this.posEnd =
40: Position.create(this.posStart.getFilePath(), this.posStart.getLineNumber(), this.posStart.getPosition()
41: + token.getLength(), this.posStart.getPosition() + token.getLength());
42: }
43:
44: /**
45: * Start-Position.
46: *
47: * @return Start-Position
48: */
49: public Position getPosStart() {
50: return this.posStart;
51: }
52:
53: /**
54: * End-Position.
55: *
56: * @return End-Position
57: */
58: public Position getPosEnd() {
59: return this.posEnd;
60: }
61: }